package com.woniuxy.cloud52.cinemaassembly.dao.dynaSqlProvider;

import com.woniuxy.cloud52.cinemaassembly.model.MovieCinema;
import org.apache.ibatis.jdbc.SQL;

public class MovieCinemaDynaSqlProvider {
    public String findAny(final MovieCinema movieCinema){
        return new SQL(){
            {
                SELECT("*");
                FROM("c_movie_cinema");
                if(movieCinema.getMovieId() != null && movieCinema.getMovieId().equals("")){
                    WHERE("movie_id","#{movieId}");
                }
                if(movieCinema.getMhid() != null && movieCinema.getMhid()>0){
                    WHERE("mhid","#{mhid}");
                }
                if(movieCinema.getSeatId() != null && movieCinema.getSeatId()>0){
                    WHERE("seat_id","#{seatId}");
                }
                if(movieCinema.getSessionsId() != null && movieCinema.getSessionsId()>0){
                    WHERE("sessions_id","#{sessionsId}");
                }
            }
        }.toString();
    }
}
